<%-- 
    Document   : ManagerCollection
    Created on : Jul 11, 2011, 7:26:33 PM
    Author     : Hai
--%>

<%@page import="server.entity.Category"%>
<%@page import="server.process.ProcessBeanLocal"%>
<%@page import="java.sql.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.text.DateFormat"%>
<%@page import="javax.naming.InitialContext"%>
<%@page import="javax.naming.Context"%>
<jsp:include page="adminheader.jsp"></jsp:include>
            <div id="main">
                <div id="adminManager">
                    <jsp:include page="lefmenu.jsp"></jsp:include>
                </div>
                <div id="contentAdmin">
                    <fieldset>
                        <legend>Manager Collection</legend>
                       <a href="newCollection.jsp">Add Category</a>
                            <h4>
                                <table border="1">
                                    <thead>
                                        <tr>
                                            <th>Collection ID</th>
                                            <th>Collection Name</th>
                                            <th>Collection Description</th>

                                            <th>Date</th>
                                            <th colspan="3">Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <%      Context ctx= new InitialContext();
                                                Object obj=ctx.lookup("ProcessLocalJNDI");
                                                ProcessBeanLocal local=(ProcessBeanLocal)obj;
                                                String  user="";
                                                boolean admin=true;
                                                DateFormat date=new SimpleDateFormat("MM/dd/yyyy");
                                              Category[] result=  local.ShowAdminCategory(user, admin);
                                              for(int i=0;i<result.length;i++){



                                        %>
                                    <form action="updateCollection.jsp" method="post">
                                        <tr>
                                            <td><%=result[i].getCollectionID()%></td>
                                            <td><%=result[i].getCollectionName()%></td>
                                            <td><%=result[i].getCollectionDescription()%></td>
                                            <td><%=date.format(result[i].getDate())%></td>

                                            <td>
                                                <input type="hidden" value="<%=result[i].getCollectionID()%>" name="id"/>
                                                <input type="submit" value="Update" name="action" />
                                            </td>
                                            <td><a href="controlertuan?id=<%=result[i].getCollectionID()%>&action=managerImage" >Manager photo</a></td>
                                          
                                            
                                        </tr>
                                         <input type="hidden" name="txtID" value="<%=result[i].getCollectionID()%>" />
                                            <input type="hidden" name="txtname" value="<%=result[i].getCollectionName()%>" />
                                            <input type="hidden" name="txtdse" value="<%=result[i].getCollectionDescription()%>" />
                                            


                                            </form>
                                        <% }%>

                                    
                                    </tbody>
                                </table>


                            </h4>
                       
                    </fieldset>
                </div>
            </div>
            <div id="footer">

            </div>
        </div>
    </body>
</html>
